--
-- PostgreSQL database dump
--

-- Started on 2011-01-21 15:08:32

SET statement_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = off;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET escape_string_warning = off;

--
-- TOC entry 368 (class 2612 OID 16386)
-- Name: plpgsql; Type: PROCEDURAL LANGUAGE; Schema: -; Owner: postgres
--

CREATE PROCEDURAL LANGUAGE plpgsql;


ALTER PROCEDURAL LANGUAGE plpgsql OWNER TO postgres;

SET search_path = public, pg_catalog;

SET default_tablespace = '';

SET default_with_oids = false;

--
-- TOC entry 1555 (class 1259 OID 16504)
-- Dependencies: 6
-- Name: atribeventos; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE atribeventos (
    cod_atribevento_pk numeric(10,0),
    str_nombre character varying(50),
    enum_tipo character(1),
    str_descrip character varying(255),
    str_campoorigen character varying(20),
    cod_evento numeric(10,0)
);


ALTER TABLE public.atribeventos OWNER TO postgres;

--
-- TOC entry 1570 (class 1259 OID 32779)
-- Dependencies: 6
-- Name: caja_cod_caja_pk_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE caja_cod_caja_pk_seq
    START WITH 43
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE public.caja_cod_caja_pk_seq OWNER TO postgres;

--
-- TOC entry 1944 (class 0 OID 0)
-- Dependencies: 1570
-- Name: caja_cod_caja_pk_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('caja_cod_caja_pk_seq', 46, true);


--
-- TOC entry 1571 (class 1259 OID 32781)
-- Dependencies: 1870 6
-- Name: cajas; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE cajas (
    cod_caja_pk integer DEFAULT nextval('caja_cod_caja_pk_seq'::regclass) NOT NULL,
    descripcion character varying
);


ALTER TABLE public.cajas OWNER TO postgres;

--
-- TOC entry 1578 (class 1259 OID 65767)
-- Dependencies: 6
-- Name: cajero_cod_cajero_pk_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE cajero_cod_cajero_pk_seq
    START WITH 3
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE public.cajero_cod_cajero_pk_seq OWNER TO postgres;

--
-- TOC entry 1945 (class 0 OID 0)
-- Dependencies: 1578
-- Name: cajero_cod_cajero_pk_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('cajero_cod_cajero_pk_seq', 4, true);


--
-- TOC entry 1589 (class 1259 OID 73823)
-- Dependencies: 1879 6
-- Name: cajeros; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE cajeros (
    cod_cajero_pk integer DEFAULT nextval('cajero_cod_cajero_pk_seq'::regclass) NOT NULL,
    nombre character varying NOT NULL,
    direccion character varying,
    telefono character varying,
    apellido character varying,
    caja integer
);


ALTER TABLE public.cajeros OWNER TO postgres;

--
-- TOC entry 1556 (class 1259 OID 16507)
-- Dependencies: 6
-- Name: clientes; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE clientes (
    cod_cliente_pk integer NOT NULL,
    nombre character varying NOT NULL,
    direccion character varying,
    telefono character varying,
    apellido character varying
);


ALTER TABLE public.clientes OWNER TO postgres;

--
-- TOC entry 1557 (class 1259 OID 16513)
-- Dependencies: 1556 6
-- Name: cliente_cod_cliente_pk_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE cliente_cod_cliente_pk_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE public.cliente_cod_cliente_pk_seq OWNER TO postgres;

--
-- TOC entry 1946 (class 0 OID 0)
-- Dependencies: 1557
-- Name: cliente_cod_cliente_pk_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE cliente_cod_cliente_pk_seq OWNED BY clientes.cod_cliente_pk;


--
-- TOC entry 1947 (class 0 OID 0)
-- Dependencies: 1557
-- Name: cliente_cod_cliente_pk_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('cliente_cod_cliente_pk_seq', 43, true);


--
-- TOC entry 1586 (class 1259 OID 65911)
-- Dependencies: 6
-- Name: compra; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE compra (
    cod_compra_pk integer NOT NULL,
    fecha date,
    proveedor integer NOT NULL,
    comprador integer NOT NULL
);


ALTER TABLE public.compra OWNER TO postgres;

--
-- TOC entry 1585 (class 1259 OID 65909)
-- Dependencies: 6 1586
-- Name: compra_cod_compra_pk_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE compra_cod_compra_pk_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE public.compra_cod_compra_pk_seq OWNER TO postgres;

--
-- TOC entry 1948 (class 0 OID 0)
-- Dependencies: 1585
-- Name: compra_cod_compra_pk_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE compra_cod_compra_pk_seq OWNED BY compra.cod_compra_pk;


--
-- TOC entry 1949 (class 0 OID 0)
-- Dependencies: 1585
-- Name: compra_cod_compra_pk_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('compra_cod_compra_pk_seq', 1, false);


--
-- TOC entry 1588 (class 1259 OID 65941)
-- Dependencies: 6
-- Name: compradetalle; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE compradetalle (
    cod_compradetalle_pk integer NOT NULL,
    producto integer NOT NULL,
    compra integer NOT NULL,
    cantidad integer NOT NULL,
    precio_compra integer NOT NULL
);


ALTER TABLE public.compradetalle OWNER TO postgres;

--
-- TOC entry 1587 (class 1259 OID 65939)
-- Dependencies: 1588 6
-- Name: compradetalle_cod_compradetalle_pk_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE compradetalle_cod_compradetalle_pk_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE public.compradetalle_cod_compradetalle_pk_seq OWNER TO postgres;

--
-- TOC entry 1950 (class 0 OID 0)
-- Dependencies: 1587
-- Name: compradetalle_cod_compradetalle_pk_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE compradetalle_cod_compradetalle_pk_seq OWNED BY compradetalle.cod_compradetalle_pk;


--
-- TOC entry 1951 (class 0 OID 0)
-- Dependencies: 1587
-- Name: compradetalle_cod_compradetalle_pk_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('compradetalle_cod_compradetalle_pk_seq', 1, false);


--
-- TOC entry 1572 (class 1259 OID 40971)
-- Dependencies: 6
-- Name: comprador_cod_comprador_pk_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE comprador_cod_comprador_pk_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE public.comprador_cod_comprador_pk_seq OWNER TO postgres;

--
-- TOC entry 1952 (class 0 OID 0)
-- Dependencies: 1572
-- Name: comprador_cod_comprador_pk_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('comprador_cod_comprador_pk_seq', 3, true);


--
-- TOC entry 1574 (class 1259 OID 40982)
-- Dependencies: 1871 6
-- Name: compradores; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE compradores (
    cod_comprador_pk integer DEFAULT nextval('comprador_cod_comprador_pk_seq'::regclass) NOT NULL,
    nombre character varying NOT NULL,
    direccion character varying,
    telefono character varying,
    apellido character varying
);


ALTER TABLE public.compradores OWNER TO postgres;

--
-- TOC entry 1558 (class 1259 OID 16515)
-- Dependencies: 6
-- Name: eventos; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE eventos (
    cod_evento_pk numeric(10,0),
    str_nombre character varying(50),
    str_descrip character varying(255)
);


ALTER TABLE public.eventos OWNER TO postgres;

--
-- TOC entry 1580 (class 1259 OID 65816)
-- Dependencies: 6
-- Name: factura_cod_factura_pk_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE factura_cod_factura_pk_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE public.factura_cod_factura_pk_seq OWNER TO postgres;

--
-- TOC entry 1953 (class 0 OID 0)
-- Dependencies: 1580
-- Name: factura_cod_factura_pk_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('factura_cod_factura_pk_seq', 1, false);


--
-- TOC entry 1581 (class 1259 OID 65818)
-- Dependencies: 1874 6
-- Name: facturas; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE facturas (
    cod_factura_pk integer DEFAULT nextval('factura_cod_factura_pk_seq'::regclass) NOT NULL,
    saldo integer NOT NULL,
    estado integer NOT NULL,
    venta integer NOT NULL
);


ALTER TABLE public.facturas OWNER TO postgres;

--
-- TOC entry 1559 (class 1259 OID 16518)
-- Dependencies: 6
-- Name: gruporeglas; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE gruporeglas (
    cod_gruporegla_pk numeric(10,0),
    str_nombre character varying(50),
    str_descrip character varying(255),
    str_usr_creacion character varying(20),
    fec_fecha_creacion date,
    time_iniperhora date,
    num_iniperdiasemana numeric(10,0),
    num_inipermes numeric(10,0)
);


ALTER TABLE public.gruporeglas OWNER TO postgres;

--
-- TOC entry 1560 (class 1259 OID 16521)
-- Dependencies: 6
-- Name: origendatos; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE origendatos (
    cod_origendato_pk numeric(10,0),
    str_nombre character varying(50),
    str_descrip character varying(255),
    enum_tipo character(5),
    str_sqlconsulta character varying(2048),
    str_ws_wsdl character varying(500),
    str_dbcon character varying(255),
    str_csv_filepath character varying(255),
    enum_periodicidad character(1),
    enum_cacheable character(1),
    cod_evento numeric(10,0),
    cod_origendato numeric(10,0)
);


ALTER TABLE public.origendatos OWNER TO postgres;

--
-- TOC entry 1579 (class 1259 OID 65773)
-- Dependencies: 6
-- Name: pago_cod_pago_pk_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE pago_cod_pago_pk_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE public.pago_cod_pago_pk_seq OWNER TO postgres;

--
-- TOC entry 1954 (class 0 OID 0)
-- Dependencies: 1579
-- Name: pago_cod_pago_pk_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('pago_cod_pago_pk_seq', 1, false);


--
-- TOC entry 1582 (class 1259 OID 65829)
-- Dependencies: 1875 6
-- Name: pagos; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE pagos (
    cod_pago_pk integer DEFAULT nextval('pago_cod_pago_pk_seq'::regclass) NOT NULL,
    caja integer NOT NULL,
    factura integer NOT NULL,
    fecha date
);


ALTER TABLE public.pagos OWNER TO postgres;

--
-- TOC entry 1561 (class 1259 OID 16527)
-- Dependencies: 6
-- Name: procesos; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE procesos (
    cod_proceso_pk numeric(10,0),
    str_nombre character varying(50),
    str_descrip character varying(255),
    str_tipo character(1),
    str_estado character(1),
    str_tipoperiodo character(1),
    str_crontipo character(1),
    num_crondiasemana numeric(10,0),
    num_crondiames numeric(10,0),
    fec_cronfecha date,
    time_cronhora date,
    cod_gruporegla numeric(10,0)
);


ALTER TABLE public.procesos OWNER TO postgres;

--
-- TOC entry 1568 (class 1259 OID 24623)
-- Dependencies: 6
-- Name: producto_cod_producto_pk_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE producto_cod_producto_pk_seq
    START WITH 3
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE public.producto_cod_producto_pk_seq OWNER TO postgres;

--
-- TOC entry 1955 (class 0 OID 0)
-- Dependencies: 1568
-- Name: producto_cod_producto_pk_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('producto_cod_producto_pk_seq', 6, true);


--
-- TOC entry 1569 (class 1259 OID 24634)
-- Dependencies: 1869 6
-- Name: productos; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE productos (
    cod_producto_pk integer DEFAULT nextval('producto_cod_producto_pk_seq'::regclass) NOT NULL,
    nombre character varying NOT NULL,
    stock integer,
    precio_actual integer,
    ganancia integer
);


ALTER TABLE public.productos OWNER TO postgres;

--
-- TOC entry 1566 (class 1259 OID 24603)
-- Dependencies: 6
-- Name: proveedor_cod_proveedor_pk_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE proveedor_cod_proveedor_pk_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE public.proveedor_cod_proveedor_pk_seq OWNER TO postgres;

--
-- TOC entry 1956 (class 0 OID 0)
-- Dependencies: 1566
-- Name: proveedor_cod_proveedor_pk_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('proveedor_cod_proveedor_pk_seq', 4, true);


--
-- TOC entry 1567 (class 1259 OID 24614)
-- Dependencies: 1868 6
-- Name: proveedores; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE proveedores (
    cod_proveedor_pk integer DEFAULT nextval('proveedor_cod_proveedor_pk_seq'::regclass) NOT NULL,
    nombre character varying NOT NULL,
    direccion character varying,
    telefono character varying,
    apellido character varying
);


ALTER TABLE public.proveedores OWNER TO postgres;

--
-- TOC entry 1562 (class 1259 OID 16530)
-- Dependencies: 6
-- Name: reglas; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE reglas (
    cod_regla_pk numeric(10,0),
    str_usrcreacion character varying(20),
    fec_fechacreacion date,
    str_condicion character varying(255),
    str_cuerpo character varying(255),
    cod_origendato numeric(10,0),
    cod_vergrpregla numeric(10,0)
);


ALTER TABLE public.reglas OWNER TO postgres;

--
-- TOC entry 1563 (class 1259 OID 16536)
-- Dependencies: 6
-- Name: sq_pk_gruporeglas; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE sq_pk_gruporeglas
    START WITH 23
    INCREMENT BY 1
    MAXVALUE 999999
    NO MINVALUE
    CACHE 1;


ALTER TABLE public.sq_pk_gruporeglas OWNER TO postgres;

--
-- TOC entry 1957 (class 0 OID 0)
-- Dependencies: 1563
-- Name: sq_pk_gruporeglas; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('sq_pk_gruporeglas', 24, true);


--
-- TOC entry 1564 (class 1259 OID 16538)
-- Dependencies: 6
-- Name: valatribeventos; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE valatribeventos (
    cod_valatribevento_pk numeric(10,0),
    str_descrip character varying(255),
    cod_atribevento numeric(10,0),
    str_valor character varying(255)
);


ALTER TABLE public.valatribeventos OWNER TO postgres;

--
-- TOC entry 1573 (class 1259 OID 40973)
-- Dependencies: 6
-- Name: vendedor_cod_vendedor_pk_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE vendedor_cod_vendedor_pk_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE public.vendedor_cod_vendedor_pk_seq OWNER TO postgres;

--
-- TOC entry 1958 (class 0 OID 0)
-- Dependencies: 1573
-- Name: vendedor_cod_vendedor_pk_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('vendedor_cod_vendedor_pk_seq', 3, true);


--
-- TOC entry 1575 (class 1259 OID 40991)
-- Dependencies: 1872 6
-- Name: vendedores; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE vendedores (
    cod_vendedor_pk integer DEFAULT nextval('vendedor_cod_vendedor_pk_seq'::regclass) NOT NULL,
    nombre character varying NOT NULL,
    direccion character varying,
    telefono character varying,
    apellido character varying
);


ALTER TABLE public.vendedores OWNER TO postgres;

--
-- TOC entry 1584 (class 1259 OID 65893)
-- Dependencies: 6
-- Name: venta; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE venta (
    cod_venta_pk integer NOT NULL,
    fecha date,
    cliente integer NOT NULL,
    vendedor integer NOT NULL
);


ALTER TABLE public.venta OWNER TO postgres;

--
-- TOC entry 1583 (class 1259 OID 65891)
-- Dependencies: 6 1584
-- Name: venta_cod_venta_pk_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE venta_cod_venta_pk_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE public.venta_cod_venta_pk_seq OWNER TO postgres;

--
-- TOC entry 1959 (class 0 OID 0)
-- Dependencies: 1583
-- Name: venta_cod_venta_pk_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE venta_cod_venta_pk_seq OWNED BY venta.cod_venta_pk;


--
-- TOC entry 1960 (class 0 OID 0)
-- Dependencies: 1583
-- Name: venta_cod_venta_pk_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('venta_cod_venta_pk_seq', 1, false);


--
-- TOC entry 1576 (class 1259 OID 49163)
-- Dependencies: 6
-- Name: ventadetalle_cod_ventadetalle_pk_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE ventadetalle_cod_ventadetalle_pk_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE public.ventadetalle_cod_ventadetalle_pk_seq OWNER TO postgres;

--
-- TOC entry 1961 (class 0 OID 0)
-- Dependencies: 1576
-- Name: ventadetalle_cod_ventadetalle_pk_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('ventadetalle_cod_ventadetalle_pk_seq', 4, true);


--
-- TOC entry 1577 (class 1259 OID 65615)
-- Dependencies: 1873 6
-- Name: ventadetalle; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE ventadetalle (
    cod_ventadetalle_pk integer DEFAULT nextval('ventadetalle_cod_ventadetalle_pk_seq'::regclass) NOT NULL,
    producto integer NOT NULL,
    venta integer NOT NULL,
    cantidad integer NOT NULL,
    precio_venta integer NOT NULL
);


ALTER TABLE public.ventadetalle OWNER TO postgres;

--
-- TOC entry 1565 (class 1259 OID 16544)
-- Dependencies: 6
-- Name: versiongruporeglas; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE versiongruporeglas (
    cod_vergrpregla_pk numeric(10,0),
    fec_vigentedesde date,
    fec_vigentehasta date,
    enum_estado character(1),
    str_usrcreacion character varying(20),
    fec_fechacreacion date,
    str_usrestado character varying(20),
    fec_fechaestado date,
    cod_gruporegla numeric(10,0)
);


ALTER TABLE public.versiongruporeglas OWNER TO postgres;

--
-- TOC entry 1867 (class 2604 OID 16547)
-- Dependencies: 1557 1556
-- Name: cod_cliente_pk; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE clientes ALTER COLUMN cod_cliente_pk SET DEFAULT nextval('cliente_cod_cliente_pk_seq'::regclass);


--
-- TOC entry 1877 (class 2604 OID 65914)
-- Dependencies: 1586 1585 1586
-- Name: cod_compra_pk; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE compra ALTER COLUMN cod_compra_pk SET DEFAULT nextval('compra_cod_compra_pk_seq'::regclass);


--
-- TOC entry 1878 (class 2604 OID 65944)
-- Dependencies: 1588 1587 1588
-- Name: cod_compradetalle_pk; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE compradetalle ALTER COLUMN cod_compradetalle_pk SET DEFAULT nextval('compradetalle_cod_compradetalle_pk_seq'::regclass);


--
-- TOC entry 1876 (class 2604 OID 65896)
-- Dependencies: 1583 1584 1584
-- Name: cod_venta_pk; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE venta ALTER COLUMN cod_venta_pk SET DEFAULT nextval('venta_cod_venta_pk_seq'::regclass);


--
-- TOC entry 1918 (class 0 OID 16504)
-- Dependencies: 1555
-- Data for Name: atribeventos; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY atribeventos (cod_atribevento_pk, str_nombre, enum_tipo, str_descrip, str_campoorigen, cod_evento) FROM stdin;
\.


--
-- TOC entry 1929 (class 0 OID 32781)
-- Dependencies: 1571
-- Data for Name: cajas; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY cajas (cod_caja_pk, descripcion) FROM stdin;
43	esta es la primera caja
44	esta es la segunda caja
45	esta es la tercera caja
\.


--
-- TOC entry 1938 (class 0 OID 73823)
-- Dependencies: 1589
-- Data for Name: cajeros; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY cajeros (cod_cajero_pk, nombre, direccion, telefono, apellido, caja) FROM stdin;
3	juan	santa elena	121212	recalde	44
4	celeste	san carlos	333333	sosa	43
\.


--
-- TOC entry 1919 (class 0 OID 16507)
-- Dependencies: 1556
-- Data for Name: clientes; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY clientes (cod_cliente_pk, nombre, direccion, telefono, apellido) FROM stdin;
7	julia	santafe	121212	talavera
9	laura	santa ana	55555	bareiro
43	sonia	sol	33333	duarte
\.


--
-- TOC entry 1936 (class 0 OID 65911)
-- Dependencies: 1586
-- Data for Name: compra; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY compra (cod_compra_pk, fecha, proveedor, comprador) FROM stdin;
\.


--
-- TOC entry 1937 (class 0 OID 65941)
-- Dependencies: 1588
-- Data for Name: compradetalle; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY compradetalle (cod_compradetalle_pk, producto, compra, cantidad, precio_compra) FROM stdin;
\.


--
-- TOC entry 1930 (class 0 OID 40982)
-- Dependencies: 1574
-- Data for Name: compradores; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY compradores (cod_comprador_pk, nombre, direccion, telefono, apellido) FROM stdin;
1	juan	asuncion	12121212	talavera
\.


--
-- TOC entry 1920 (class 0 OID 16515)
-- Dependencies: 1558
-- Data for Name: eventos; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY eventos (cod_evento_pk, str_nombre, str_descrip) FROM stdin;
\.


--
-- TOC entry 1933 (class 0 OID 65818)
-- Dependencies: 1581
-- Data for Name: facturas; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY facturas (cod_factura_pk, saldo, estado, venta) FROM stdin;
\.


--
-- TOC entry 1921 (class 0 OID 16518)
-- Dependencies: 1559
-- Data for Name: gruporeglas; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY gruporeglas (cod_gruporegla_pk, str_nombre, str_descrip, str_usr_creacion, fec_fecha_creacion, time_iniperhora, num_iniperdiasemana, num_inipermes) FROM stdin;
\.


--
-- TOC entry 1922 (class 0 OID 16521)
-- Dependencies: 1560
-- Data for Name: origendatos; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY origendatos (cod_origendato_pk, str_nombre, str_descrip, enum_tipo, str_sqlconsulta, str_ws_wsdl, str_dbcon, str_csv_filepath, enum_periodicidad, enum_cacheable, cod_evento, cod_origendato) FROM stdin;
\.


--
-- TOC entry 1934 (class 0 OID 65829)
-- Dependencies: 1582
-- Data for Name: pagos; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY pagos (cod_pago_pk, caja, factura, fecha) FROM stdin;
\.


--
-- TOC entry 1923 (class 0 OID 16527)
-- Dependencies: 1561
-- Data for Name: procesos; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY procesos (cod_proceso_pk, str_nombre, str_descrip, str_tipo, str_estado, str_tipoperiodo, str_crontipo, num_crondiasemana, num_crondiames, fec_cronfecha, time_cronhora, cod_gruporegla) FROM stdin;
\.


--
-- TOC entry 1928 (class 0 OID 24634)
-- Dependencies: 1569
-- Data for Name: productos; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY productos (cod_producto_pk, nombre, stock, precio_actual, ganancia) FROM stdin;
3	teclado	32	10	10
4	mouse	50	5	20
5	monitor	54	150	10
\.


--
-- TOC entry 1927 (class 0 OID 24614)
-- Dependencies: 1567
-- Data for Name: proveedores; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY proveedores (cod_proveedor_pk, nombre, direccion, telefono, apellido) FROM stdin;
1	diego	san juan	121212	torres
2	maxi	san jose	8787878	baez
4	roberto	gomez	99999	bañuelos
\.


--
-- TOC entry 1924 (class 0 OID 16530)
-- Dependencies: 1562
-- Data for Name: reglas; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY reglas (cod_regla_pk, str_usrcreacion, fec_fechacreacion, str_condicion, str_cuerpo, cod_origendato, cod_vergrpregla) FROM stdin;
\.


--
-- TOC entry 1925 (class 0 OID 16538)
-- Dependencies: 1564
-- Data for Name: valatribeventos; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY valatribeventos (cod_valatribevento_pk, str_descrip, cod_atribevento, str_valor) FROM stdin;
\.


--
-- TOC entry 1931 (class 0 OID 40991)
-- Dependencies: 1575
-- Data for Name: vendedores; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY vendedores (cod_vendedor_pk, nombre, direccion, telefono, apellido) FROM stdin;
1	genaro	luque	444444	rojas
2	luis	lambare	99999	salinas
\.


--
-- TOC entry 1935 (class 0 OID 65893)
-- Dependencies: 1584
-- Data for Name: venta; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY venta (cod_venta_pk, fecha, cliente, vendedor) FROM stdin;
\.


--
-- TOC entry 1932 (class 0 OID 65615)
-- Dependencies: 1577
-- Data for Name: ventadetalle; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY ventadetalle (cod_ventadetalle_pk, producto, venta, cantidad, precio_venta) FROM stdin;
\.


--
-- TOC entry 1926 (class 0 OID 16544)
-- Dependencies: 1565
-- Data for Name: versiongruporeglas; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY versiongruporeglas (cod_vergrpregla_pk, fec_vigentedesde, fec_vigentehasta, enum_estado, str_usrcreacion, fec_fechacreacion, str_usrestado, fec_fechaestado, cod_gruporegla) FROM stdin;
\.


--
-- TOC entry 1901 (class 2606 OID 65916)
-- Dependencies: 1586 1586
-- Name: codcompra_pk_constraint; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY compra
    ADD CONSTRAINT codcompra_pk_constraint PRIMARY KEY (cod_compra_pk);


--
-- TOC entry 1903 (class 2606 OID 65946)
-- Dependencies: 1588 1588
-- Name: codcompradetalle_pk_constraint; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY compradetalle
    ADD CONSTRAINT codcompradetalle_pk_constraint PRIMARY KEY (cod_compradetalle_pk);


--
-- TOC entry 1899 (class 2606 OID 65898)
-- Dependencies: 1584 1584
-- Name: codventa_pk_constraint; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY venta
    ADD CONSTRAINT codventa_pk_constraint PRIMARY KEY (cod_venta_pk);


--
-- TOC entry 1893 (class 2606 OID 65620)
-- Dependencies: 1577 1577
-- Name: codventadetalle_pk_constraint; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY ventadetalle
    ADD CONSTRAINT codventadetalle_pk_constraint PRIMARY KEY (cod_ventadetalle_pk);


--
-- TOC entry 1887 (class 2606 OID 32789)
-- Dependencies: 1571 1571
-- Name: pk_codcaja; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY cajas
    ADD CONSTRAINT pk_codcaja PRIMARY KEY (cod_caja_pk);


--
-- TOC entry 1905 (class 2606 OID 73831)
-- Dependencies: 1589 1589
-- Name: pk_codcajero; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY cajeros
    ADD CONSTRAINT pk_codcajero PRIMARY KEY (cod_cajero_pk);


--
-- TOC entry 1881 (class 2606 OID 16549)
-- Dependencies: 1556 1556
-- Name: pk_codcliente; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY clientes
    ADD CONSTRAINT pk_codcliente PRIMARY KEY (cod_cliente_pk);


--
-- TOC entry 1889 (class 2606 OID 40990)
-- Dependencies: 1574 1574
-- Name: pk_codcomprador; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY compradores
    ADD CONSTRAINT pk_codcomprador PRIMARY KEY (cod_comprador_pk);


--
-- TOC entry 1895 (class 2606 OID 65823)
-- Dependencies: 1581 1581
-- Name: pk_codfactura; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY facturas
    ADD CONSTRAINT pk_codfactura PRIMARY KEY (cod_factura_pk);


--
-- TOC entry 1897 (class 2606 OID 65834)
-- Dependencies: 1582 1582
-- Name: pk_codpago; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY pagos
    ADD CONSTRAINT pk_codpago PRIMARY KEY (cod_pago_pk);


--
-- TOC entry 1885 (class 2606 OID 24642)
-- Dependencies: 1569 1569
-- Name: pk_codproducto; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY productos
    ADD CONSTRAINT pk_codproducto PRIMARY KEY (cod_producto_pk);


--
-- TOC entry 1883 (class 2606 OID 24622)
-- Dependencies: 1567 1567
-- Name: pk_codproveedor; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY proveedores
    ADD CONSTRAINT pk_codproveedor PRIMARY KEY (cod_proveedor_pk);


--
-- TOC entry 1891 (class 2606 OID 40999)
-- Dependencies: 1575 1575
-- Name: pk_codvendedor; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY vendedores
    ADD CONSTRAINT pk_codvendedor PRIMARY KEY (cod_vendedor_pk);


--
-- TOC entry 1910 (class 2606 OID 65840)
-- Dependencies: 1582 1886 1571
-- Name: codcaja_fk; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY pagos
    ADD CONSTRAINT codcaja_fk FOREIGN KEY (caja) REFERENCES cajas(cod_caja_pk);


--
-- TOC entry 1917 (class 2606 OID 73832)
-- Dependencies: 1886 1571 1589
-- Name: codcaja_fk; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY cajeros
    ADD CONSTRAINT codcaja_fk FOREIGN KEY (caja) REFERENCES cajas(cod_caja_pk);


--
-- TOC entry 1912 (class 2606 OID 65904)
-- Dependencies: 1584 1880 1556
-- Name: codcliente_fk; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY venta
    ADD CONSTRAINT codcliente_fk FOREIGN KEY (cliente) REFERENCES clientes(cod_cliente_pk);


--
-- TOC entry 1916 (class 2606 OID 65952)
-- Dependencies: 1586 1588 1900
-- Name: codcompra_fk; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY compradetalle
    ADD CONSTRAINT codcompra_fk FOREIGN KEY (compra) REFERENCES compra(cod_compra_pk);


--
-- TOC entry 1913 (class 2606 OID 65917)
-- Dependencies: 1888 1586 1574
-- Name: codcomprador_fk; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY compra
    ADD CONSTRAINT codcomprador_fk FOREIGN KEY (comprador) REFERENCES compradores(cod_comprador_pk);


--
-- TOC entry 1909 (class 2606 OID 65835)
-- Dependencies: 1581 1582 1894
-- Name: codfactura_fk; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY pagos
    ADD CONSTRAINT codfactura_fk FOREIGN KEY (factura) REFERENCES facturas(cod_factura_pk);


--
-- TOC entry 1906 (class 2606 OID 65621)
-- Dependencies: 1569 1577 1884
-- Name: codproducto_fk; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY ventadetalle
    ADD CONSTRAINT codproducto_fk FOREIGN KEY (producto) REFERENCES productos(cod_producto_pk);


--
-- TOC entry 1915 (class 2606 OID 65947)
-- Dependencies: 1588 1884 1569
-- Name: codproducto_fk; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY compradetalle
    ADD CONSTRAINT codproducto_fk FOREIGN KEY (producto) REFERENCES productos(cod_producto_pk);


--
-- TOC entry 1914 (class 2606 OID 65922)
-- Dependencies: 1567 1882 1586
-- Name: codproveedor_fk; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY compra
    ADD CONSTRAINT codproveedor_fk FOREIGN KEY (proveedor) REFERENCES proveedores(cod_proveedor_pk);


--
-- TOC entry 1911 (class 2606 OID 65899)
-- Dependencies: 1890 1584 1575
-- Name: codvendedor_fk; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY venta
    ADD CONSTRAINT codvendedor_fk FOREIGN KEY (vendedor) REFERENCES vendedores(cod_vendedor_pk);


--
-- TOC entry 1907 (class 2606 OID 65929)
-- Dependencies: 1584 1898 1577
-- Name: codventa_fk; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY ventadetalle
    ADD CONSTRAINT codventa_fk FOREIGN KEY (venta) REFERENCES venta(cod_venta_pk);


--
-- TOC entry 1908 (class 2606 OID 65934)
-- Dependencies: 1581 1584 1898
-- Name: codventa_fk; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY facturas
    ADD CONSTRAINT codventa_fk FOREIGN KEY (venta) REFERENCES venta(cod_venta_pk);


--
-- TOC entry 1943 (class 0 OID 0)
-- Dependencies: 6
-- Name: public; Type: ACL; Schema: -; Owner: postgres
--

REVOKE ALL ON SCHEMA public FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM postgres;
GRANT ALL ON SCHEMA public TO postgres;
GRANT ALL ON SCHEMA public TO PUBLIC;


-- Completed on 2011-01-21 15:08:35

--
-- PostgreSQL database dump complete
--

